﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace CJAtech.BBS.Web
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapMvcAttributeRoutes();

            routes.MapRoute(
                name: "BBSCommoninfo",
                url: "{controller}/{action}/thread-{view}/{id}"
            );

            routes.MapRoute(
                name: "DynamicView",
                url: "{controller}/{action}/view-{view}/{id}",
                defaults: new { id = UrlParameter.Optional }
            );

            #region SSOBBS
            routes.MapRoute(
                name: "SSOBBStatic",
                url: "BBS/{BBSName}/Static/{ViewName}",
                defaults: new { controller = "SSOBBS", action = "StaticTemplate" }
            );

            routes.MapRoute(
                name: "SSOBBSStaticPower",
                url: "BBS/{BBSName}/StaticPower/{ViewName}",
                defaults: new { controller = "SSOBBS", action = "StaticPowerTemplate" }
            );

            routes.MapRoute(
                name: "SSOBBSArticles",
                url: "BBS/{BBSName}/{ViewName}/Articles",
                defaults: new { controller = "SSOBBS", action = "ArticlesTemplate" }
            );

            routes.MapRoute(
                name: "SSOBBSArticle",
                url: "BBS/{BBSName}/{ViewName}/Article",
                defaults: new { controller = "SSOBBS", action = "ArticleTemplate" }
            );

            routes.MapRoute(
                name: "SSOBBS",
                url: "BBS/{BBSName}/{action}/{id}",
                defaults: new { controller = "SSOBBS", action = "Index", id = UrlParameter.Optional }
            );
            #endregion

            #region WXBBS
            routes.MapRoute(
                name: "WXBBStatic",
                url: "WXBBS/{BBSName}/Static/{ViewName}",
                defaults: new { controller = "SSOBBS", action = "StaticTemplate" }
            );

            routes.MapRoute(
                name: "WXBBSStaticPower",
                url: "WXBBS/{BBSName}/StaticPower/{ViewName}",
                defaults: new { controller = "SSOBBS", action = "StaticPowerTemplate" }
            );

            routes.MapRoute(
                name: "WXBBSArticles",
                url: "WXBBS/{BBSName}/{ViewName}/Articles",
                defaults: new { controller = "SSOBBS", action = "ArticlesTemplate" }
            );

            routes.MapRoute(
                name: "WXBBSArticle",
                url: "WXBBS/{BBSName}/{ViewName}/Article",
                defaults: new { controller = "SSOBBS", action = "ArticleTemplate" }
            );

            routes.MapRoute(
                name: "WXBBS",
                url: "WXBBS/{BBSName}/{action}/{id}",
                defaults: new { controller = "WXBBS", action = "Index", id = UrlParameter.Optional }
            );
            #endregion

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
